package com.sylar.happyreader;

import android.app.Application;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;

import com.sylar.happyreader.tools.ImageCache;

public class BookApplication extends Application{
	private ImageCache mImageCache;
	private static BookApplication instance;
	private Bitmap mCurPageBitmap ,mNextPageBitmap;
	
	public void setmNextPageBitmap(Bitmap mNextPageBitmap) {
		this.mNextPageBitmap = mNextPageBitmap;
	}

	public void setmCurPageBitmap(Bitmap mCurPageBitmap) {
		this.mCurPageBitmap = mCurPageBitmap;
	}
	
	public Bitmap getmCurPageBitmap() {
		return mCurPageBitmap;
	}

	public Bitmap getmNextPageBitmap() {
		return mNextPageBitmap;
	}

	@Override
	public void onCreate() {
//		mNextPageBitmap = Bitmap.createBitmap(480, 800, Bitmap.Config.ARGB_8888);
//		mCurPageBitmap = Bitmap.createBitmap(480, 800, Bitmap.Config.ARGB_8888);
		super.onCreate();
		instance = this;
		mImageCache = new ImageCache();
	}
	public static BookApplication getInstance() {
		return instance;
	}
	public ImageCache getImageCache(){
		return mImageCache;
	}
	
	public int getVersionCode() {
		PackageManager localPackageManager = getPackageManager();
		String packageName = getPackageName();
		int Version = -1;
		try {
			Version = localPackageManager.getPackageInfo(packageName, 0).versionCode;
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		return Version;
	}
}
